<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>唐诗三百首全集</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: "SimSun", "宋体", serif;
            background-color: #f8f3e6;
            color: #333;
            line-height: 1.6;
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.05"><path d="M0,0 L100,100 M100,0 L0,100" stroke="%23000" stroke-width="1"/></svg>');
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        
        header {
            text-align: center;
            padding: 30px 0;
            border-bottom: 2px solid #8c2e0b;
            margin-bottom: 30px;
            background: linear-gradient(to right, #8c2e0b, #d4a76a);
            color: white;
            border-radius: 5px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }
        
        h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .subtitle {
            font-size: 1.2rem;
            opacity: 0.9;
        }
        
        .controls {
            display: flex;
            justify-content: space-between;
            margin-bottom: 20px;
            flex-wrap: wrap;
            gap: 10px;
        }
        
        .search-box {
            flex: 1;
            min-width: 250px;
            position: relative;
        }
        
        .search-box input {
            width: 100%;
            padding: 10px 15px;
            border: 1px solid #d4a76a;
            border-radius: 25px;
            font-size: 1rem;
            background-color: #fffdf9;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        }
        
        .search-box input:focus {
            outline: none;
            border-color: #8c2e0b;
            box-shadow: 0 0 5px rgba(140, 46, 11, 0.3);
        }
        
        .filter-section {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
        
        select {
            padding: 10px 15px;
            border: 1px solid #d4a76a;
            border-radius: 5px;
            background-color: #fffdf9;
            font-size: 1rem;
            cursor: pointer;
        }
        
        select:focus {
            outline: none;
            border-color: #8c2e0b;
        }
        
        .poetry-sections {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 25px;
        }
        
        .section {
            background-color: #fffdf9;
            border: 1px solid #e8d9c3;
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        
        .section:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        }
        
        .section-title {
            font-size: 1.4rem;
            color: #8c2e0b;
            margin-bottom: 15px;
            padding-bottom: 8px;
            border-bottom: 1px solid #e8d9c3;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .count {
            background-color: #8c2e0b;
            color: white;
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 0.8rem;
        }
        
        .poem-list {
            list-style-type: none;
        }
        
        .poem-item {
            padding: 8px 0;
            border-bottom: 1px dashed #e8d9c3;
            display: flex;
            justify-content: space-between;
        }
        
        .poem-item:last-child {
            border-bottom: none;
        }
        
        .poem-title {
            font-weight: bold;
            color: #5a3921;
        }
        
        .poem-author {
            color: #8c2e0b;
            font-style: italic;
        }
        
        footer {
            text-align: center;
            margin-top: 40px;
            padding: 20px;
            color: #7a6a5a;
            border-top: 1px solid #e8d9c3;
        }
        
        @media (max-width: 768px) {
            .poetry-sections {
                grid-template-columns: 1fr;
            }
            
            .controls {
                flex-direction: column;
            }
            
            .search-box {
                min-width: 100%;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1>唐诗三百首</h1>
            <div class="subtitle">中华文化瑰宝 · 千年传世经典</div>
        </header>
        
        <div class="controls">
            <div class="search-box">
                <input type="text" id="searchInput" placeholder="搜索诗歌标题或作者...">
            </div>
            <div class="filter-section">
                <select id="typeFilter">
                    <option value="all">所有体裁</option>
                    <option value="五言古诗">五言古诗</option>
                    <option value="七言古诗">七言古诗</option>
                    <option value="五言律诗">五言律诗</option>
                    <option value="七言律诗">七言律诗</option>
                    <option value="五言绝句">五言绝句</option>
                    <option value="七言绝句">七言绝句</option>
                    <option value="乐府诗">乐府诗</option>
                </select>
                <select id="authorFilter">
                    <option value="all">所有作者</option>
                </select>
            </div>
        </div>
        
        <div class="poetry-sections" id="poetryContainer">
            <!-- 诗歌内容将通过JavaScript动态生成 -->
        </div>
        
        <footer>
            <p>唐诗三百首 · 清·蘅塘退士 编</p>
            <p>中华古典文学瑰宝 · 传承千年文化</p>
        </footer>
    </div>

    <script>
        // 唐诗数据
        const tangPoems = [
            {
                type: "五言古诗",
                poems: [
                    { title: "感遇·其一", author: "张九龄" },
                    { title: "感遇·其二", author: "张九龄" },
                    { title: "下终南山过斛斯山人宿置酒", author: "李白" },
                    { title: "月下独酌", author: "李白" },
                    { title: "春思", author: "李白" },
                    { title: "望岳", author: "杜甫" },
                    { title: "赠卫八处士", author: "杜甫" },
                    { title: "佳人", author: "杜甫" },
                    { title: "梦李白·其一", author: "杜甫" },
                    { title: "梦李白·其二", author: "杜甫" },
                    { title: "送綦毋潜落第还乡", author: "王维" },
                    { title: "送别", author: "王维" },
                    { title: "青溪", author: "王维" },
                    { title: "渭川田家", author: "王维" },
                    { title: "西施咏", author: "王维" },
                    { title: "秋登兰山寄张五", author: "孟浩然" },
                    { title: "夏日南亭怀辛大", author: "孟浩然" },
                    { title: "宿业师山房期丁大不至", author: "孟浩然" },
                    { title: "同从弟南斋玩月忆山阴崔少府", author: "王昌龄" },
                    { title: "寻西山隐者不遇", author: "丘为" },
                    { title: "春泛若耶溪", author: "綦毋潜" },
                    { title: "宿王昌龄隐居", author: "常建" },
                    { title: "与高适薛据登慈恩寺浮图", author: "岑参" },
                    { title: "贼退示官吏·并序", author: "元结" },
                    { title: "郡斋雨中与诸文士燕集", author: "韦应物" },
                    { title: "初发扬子寄元大校书", author: "韦应物" },
                    { title: "寄全椒山中道士", author: "韦应物" },
                    { title: "长安遇冯著", author: "韦应物" },
                    { title: "夕次盱眙县", author: "韦应物" },
                    { title: "东郊", author: "韦应物" },
                    { title: "送杨氏女", author: "韦应物" },
                    { title: "晨诣超师院读禅经", author: "柳宗元" },
                    { title: "溪居", author: "柳宗元" }
                ]
            },
            {
                type: "七言古诗",
                poems: [
                    { title: "登幽州台歌", author: "陈子昂" },
                    { title: "古意", author: "李颀" },
                    { title: "送陈章甫", author: "李颀" },
                    { title: "琴歌", author: "李颀" },
                    { title: "听董大弹胡笳声兼寄语弄房给事", author: "李颀" },
                    { title: "听安万善吹觱篥歌", author: "李颀" },
                    { title: "夜归鹿门歌", author: "孟浩然" },
                    { title: "庐山谣寄卢侍御虚舟", author: "李白" },
                    { title: "梦游天姥吟留别", author: "李白" },
                    { title: "金陵酒肆留别", author: "李白" },
                    { title: "宣州谢朓楼饯别校书叔云", author: "李白" },
                    { title: "走马川行奉送封大夫出师西征", author: "岑参" },
                    { title: "轮台歌奉送封大夫出师西征", author: "岑参" },
                    { title: "白雪歌送武判官归京", author: "岑参" },
                    { title: "韦讽录事宅观曹将军画马图", author: "杜甫" },
                    { title: "丹青引赠曹将军霸", author: "杜甫" },
                    { title: "寄韩谏议注", author: "杜甫" },
                    { title: "古柏行", author: "杜甫" },
                    { title: "观公孙大娘弟子舞剑器行", author: "杜甫" },
                    { title: "石鱼湖上醉歌", author: "元结" },
                    { title: "山石", author: "韩愈" },
                    { title: "八月十五夜赠张功曹", author: "韩愈" },
                    { title: "谒衡岳庙遂宿岳寺题门楼", author: "韩愈" },
                    { title: "石鼓歌", author: "韩愈" },
                    { title: "渔翁", author: "柳宗元" },
                    { title: "长恨歌", author: "白居易" },
                    { title: "琵琶行", author: "白居易" },
                    { title: "韩碑", author: "李商隐" }
                ]
            },
            {
                type: "五言律诗",
                poems: [
                    { title: "经邹鲁祭孔子而叹之", author: "唐玄宗" },
                    { title: "望月怀远", author: "张九龄" },
                    { title: "送杜少府之任蜀州", author: "王勃" },
                    { title: "在狱咏蝉", author: "骆宾王" },
                    { title: "和晋陵陆丞早春游望", author: "杜审言" },
                    { title: "杂诗", author: "沈佺期" },
                    { title: "题大庾岭北驿", author: "宋之问" },
                    { title: "次北固山下", author: "王湾" },
                    { title: "破山寺后禅院", author: "常建" },
                    { title: "寄左省杜拾遗", author: "岑参" },
                    { title: "赠孟浩然", author: "李白" },
                    { title: "渡荆门送别", author: "李白" },
                    { title: "送友人", author: "李白" },
                    { title: "听蜀僧濬弹琴", author: "李白" },
                    { title: "夜泊牛渚怀古", author: "李白" },
                    { title: "春望", author: "杜甫" },
                    { title: "月夜", author: "杜甫" },
                    { title: "春宿左省", author: "杜甫" },
                    { title: "至德二载甫自京金光门出间道归凤翔乾元初从左拾遗移华州掾与亲故别因出此门有悲往事", author: "杜甫" },
                    { title: "月夜忆舍弟", author: "杜甫" },
                    { title: "天末怀李白", author: "杜甫" },
                    { title: "奉济驿重送严公四韵", author: "杜甫" },
                    { title: "别房太尉墓", author: "杜甫" },
                    { title: "旅夜书怀", author: "杜甫" },
                    { title: "登岳阳楼", author: "杜甫" },
                    { title: "辋川闲居赠裴秀才迪", author: "王维" },
                    { title: "山居秋暝", author: "王维" },
                    { title: "归嵩山作", author: "王维" },
                    { title: "终南山", author: "王维" },
                    { title: "酬张少府", author: "王维" },
                    { title: "过香积寺", author: "王维" },
                    { title: "送梓州李使君", author: "王维" },
                    { title: "汉江临泛", author: "王维" },
                    { title: "终南别业", author: "王维" },
                    { title: "临洞庭上张丞相", author: "孟浩然" },
                    { title: "与诸子登岘山", author: "孟浩然" },
                    { title: "宴梅道士山房", author: "孟浩然" },
                    { title: "岁暮归南山", author: "孟浩然" },
                    { title: "过故人庄", author: "孟浩然" },
                    { title: "秦中感秋寄远上人", author: "孟浩然" },
                    { title: "宿桐庐江寄广陵旧游", author: "孟浩然" },
                    { title: "留别王维", author: "孟浩然" },
                    { title: "早寒有怀", author: "孟浩然" },
                    { title: "秋日登吴公台上寺远眺", author: "刘长卿" },
                    { title: "送李中丞归汉阳别业", author: "刘长卿" },
                    { title: "饯别王十一南游", author: "刘长卿" },
                    { title: "寻南溪常道士", author: "刘长卿" },
                    { title: "新年作", author: "刘长卿" },
                    { title: "送僧归日本", author: "钱起" },
                    { title: "谷口书斋寄杨补阙", author: "钱起" },
                    { title: "淮上喜会梁州故人", author: "韦应物" },
                    { title: "赋得暮雨送李胄", author: "韦应物" },
                    { title: "酬程延秋夜即事见赠", author: "韩翃" },
                    { title: "阙题", author: "刘昚虚" },
                    { title: "客舍喜崔补阙司空拾遗访宿", author: "卢纶" },
                    { title: "喜外弟卢纶见宿", author: "司空曙" },
                    { title: "贼平后送人北归", author: "司空曙" },
                    { title: "蜀先主庙", author: "刘禹锡" },
                    { title: "没蕃故人", author: "张籍" },
                    { title: "草", author: "白居易" },
                    { title: "旅宿", author: "杜牧" },
                    { title: "秋日赴阙题潼关驿楼", author: "许浑" },
                    { title: "早秋", author: "许浑" },
                    { title: "蝉", author: "李商隐" },
                    { title: "风雨", author: "李商隐" },
                    { title: "落花", author: "李商隐" },
                    { title: "凉思", author: "李商隐" },
                    { title: "北青萝", author: "李商隐" },
                    { title: "送人东游", author: "温庭筠" },
                    { title: "灞上秋居", author: "马戴" },
                    { title: "楚江怀古", author: "马戴" },
                    { title: "书边事", author: "张乔" },
                    { title: "除夜有怀", author: "崔涂" },
                    { title: "孤雁", author: "崔涂" },
                    { title: "题破山寺后禅院", author: "常建" },
                    { title: "望蓟门", author: "祖咏" },
                    { title: "九日登望仙台呈刘明府", author: "崔曙" },
                    { title: "送魏万之京", author: "李颀" },
                    { title: "登金陵凤凰台", author: "李白" },
                    { title: "送李少府贬峡中王少府贬长沙", author: "高适" }
                ]
            },
            {
                type: "七言律诗",
                poems: [
                    { title: "黄鹤楼", author: "崔颢" },
                    { title: "行经华阴", author: "崔颢" },
                    { title: "望蓟门", author: "祖咏" },
                    { title: "九日登望仙台呈刘明府", author: "崔曙" },
                    { title: "送魏万之京", author: "李颀" },
                    { title: "登金陵凤凰台", author: "李白" },
                    { title: "送李少府贬峡中王少府贬长沙", author: "高适" },
                    { title: "和贾至舍人早朝大明宫之作", author: "岑参" },
                    { title: "和贾至舍人早朝大明宫之作", author: "王维" },
                    { title: "奉和圣制从蓬莱向兴庆阁道中留春雨中春望之作应制", author: "王维" },
                    { title: "积雨辋川庄作", author: "王维" },
                    { title: "赠郭给事", author: "王维" },
                    { title: "蜀相", author: "杜甫" },
                    { title: "客至", author: "杜甫" },
                    { title: "野望", author: "杜甫" },
                    { title: "闻官军收河南河北", author: "杜甫" },
                    { title: "登高", author: "杜甫" },
                    { title: "登楼", author: "杜甫" },
                    { title: "宿府", author: "杜甫" },
                    { title: "阁夜", author: "杜甫" },
                    { title: "咏怀古迹·其一", author: "杜甫" },
                    { title: "咏怀古迹·其二", author: "杜甫" },
                    { title: "咏怀古迹·其三", author: "杜甫" },
                    { title: "咏怀古迹·其四", author: "杜甫" },
                    { title: "咏怀古迹·其五", author: "杜甫" },
                    { title: "江州重别薛六柳八二员外", author: "刘长卿" },
                    { title: "长沙过贾谊宅", author: "刘长卿" },
                    { title: "自夏口至鹦鹉洲夕望岳阳寄源中丞", author: "刘长卿" },
                    { title: "赠阙下裴舍人", author: "钱起" },
                    { title: "寄李儋元锡", author: "韦应物" },
                    { title: "同题仙游观", author: "韩翃" },
                    { title: "春思", author: "皇甫冉" },
                    { title: "晚次鄂州", author: "卢纶" },
                    { title: "登柳州城楼寄漳汀封连四州刺史", author: "柳宗元" },
                    { title: "西塞山怀古", author: "刘禹锡" },
                    { title: "遣悲怀·其一", author: "元稹" },
                    { title: "遣悲怀·其二", author: "元稹" },
                    { title: "遣悲怀·其三", author: "元稹" },
                    { title: "自河南经乱关内阻饥兄弟离散各在一处因望月有感聊书所怀寄上浮梁大兄於潜七兄乌江十五兄兼示符离及下邽弟妹", author: "白居易" },
                    { title: "锦瑟", author: "李商隐" },
                    { title: "无题", author: "李商隐" },
                    { title: "隋宫", author: "李商隐" },
                    { title: "无题·其一", author: "李商隐" },
                    { title: "无题·其二", author: "李商隐" },
                    { title: "筹笔驿", author: "李商隐" },
                    { title: "无题", author: "李商隐" },
                    { title: "春雨", author: "李商隐" },
                    { title: "无题·其一", author: "李商隐" },
                    { title: "无题·其二", author: "李商隐" },
                    { title: "利州南渡", author: "温庭筠" },
                    { title: "苏武庙", author: "温庭筠" },
                    { title: "宫词", author: "薛逢" },
                    { title: "贫女", author: "秦韬玉" },
                    { title: "独不见", author: "沈佺期" }
                ]
            },
            {
                type: "五言绝句",
                poems: [
                    { title: "鹿柴", author: "王维" },
                    { title: "竹里馆", author: "王维" },
                    { title: "送别", author: "王维" },
                    { title: "相思", author: "王维" },
                    { title: "杂诗", author: "王维" },
                    { title: "送崔九", author: "裴迪" },
                    { title: "终南望余雪", author: "祖咏" },
                    { title: "宿建德江", author: "孟浩然" },
                    { title: "春晓", author: "孟浩然" },
                    { title: "静夜思", author: "李白" },
                    { title: "怨情", author: "李白" },
                    { title: "八阵图", author: "杜甫" },
                    { title: "登鹳雀楼", author: "王之涣" },
                    { title: "送灵澈", author: "刘长卿" },
                    { title: "弹琴", author: "刘长卿" },
                    { title: "送上人", author: "刘长卿" },
                    { title: "秋夜寄丘员外", author: "韦应物" },
                    { title: "听筝", author: "李端" },
                    { title: "新嫁娘", author: "王建" },
                    { title: "玉台体", author: "权德舆" },
                    { title: "江雪", author: "柳宗元" },
                    { title: "行宫", author: "元稹" },
                    { title: "问刘十九", author: "白居易" },
                    { title: "何满子", author: "张祜" },
                    { title: "登乐游原", author: "李商隐" },
                    { title: "寻隐者不遇", author: "贾岛" },
                    { title: "渡汉江", author: "李频" },
                    { title: "春怨", author: "金昌绪" },
                    { title: "哥舒歌", author: "西鄙人" },
                    { title: "长干行·其一", author: "崔颢" },
                    { title: "长干行·其二", author: "崔颢" },
                    { title: "玉阶怨", author: "李白" },
                    { title: "塞下曲·其一", author: "卢纶" },
                    { title: "塞下曲·其二", author: "卢纶" },
                    { title: "塞下曲·其三", author: "卢纶" },
                    { title: "塞下曲·其四", author: "卢纶" },
                    { title: "江南曲", author: "李益" }
                ]
            },
            {
                type: "七言绝句",
                poems: [
                    { title: "回乡偶书", author: "贺知章" },
                    { title: "桃花溪", author: "张旭" },
                    { title: "九月九日忆山东兄弟", author: "王维" },
                    { title: "芙蓉楼送辛渐", author: "王昌龄" },
                    { title: "闺怨", author: "王昌龄" },
                    { title: "春宫曲", author: "王昌龄" },
                    { title: "凉州词", author: "王翰" },
                    { title: "黄鹤楼送孟浩然之广陵", author: "李白" },
                    { title: "早发白帝城", author: "李白" },
                    { title: "逢入京使", author: "岑参" },
                    { title: "江南逢李龟年", author: "杜甫" },
                    { title: "滁州西涧", author: "韦应物" },
                    { title: "枫桥夜泊", author: "张继" },
                    { title: "寒食", author: "韩翃" },
                    { title: "月夜", author: "刘方平" },
                    { title: "春怨", author: "刘方平" },
                    { title: "征人怨", author: "柳中庸" },
                    { title: "宫词", author: "顾况" },
                    { title: "夜上受降城闻笛", author: "李益" },
                    { title: "乌衣巷", author: "刘禹锡" },
                    { title: "春词", author: "刘禹锡" },
                    { title: "宫词", author: "白居易" },
                    { title: "赠内人", author: "张祜" },
                    { title: "集灵台·其一", author: "张祜" },
                    { title: "集灵台·其二", author: "张祜" },
                    { title: "题金陵渡", author: "张祜" },
                    { title: "宫中词", author: "朱庆馀" },
                    { title: "近试上张水部", author: "朱庆馀" },
                    { title: "将赴吴兴登乐游原", author: "杜牧" },
                    { title: "赤壁", author: "杜牧" },
                    { title: "泊秦淮", author: "杜牧" },
                    { title: "寄扬州韩绰判官", author: "杜牧" },
                    { title: "遣怀", author: "杜牧" },
                    { title: "秋夕", author: "杜牧" },
                    { title: "赠别·其一", author: "杜牧" },
                    { title: "赠别·其二", author: "杜牧" },
                    { title: "金谷园", author: "杜牧" },
                    { title: "夜雨寄北", author: "李商隐" },
                    { title: "寄令狐郎中", author: "李商隐" },
                    { title: "为有", author: "李商隐" },
                    { title: "隋宫", author: "李商隐" },
                    { title: "瑶池", author: "李商隐" },
                    { title: "嫦娥", author: "李商隐" },
                    { title: "贾生", author: "李商隐" },
                    { title: "瑶瑟怨", author: "温庭筠" },
                    { title: "马嵬坡", author: "郑畋" },
                    { title: "已凉", author: "韩偓" },
                    { title: "台城", author: "韦庄" },
                    { title: "陇西行", author: "陈陶" },
                    { title: "寄人", author: "张泌" },
                    { title: "杂诗", author: "无名氏" },
                    { title: "渭城曲", author: "王维" },
                    { title: "秋夜曲", author: "王维" },
                    { title: "长信怨", author: "王昌龄" },
                    { title: "出塞", author: "王昌龄" },
                    { title: "清平调·其一", author: "李白" },
                    { title: "清平调·其二", author: "李白" },
                    { title: "清平调·其三", author: "李白" },
                    { title: "出塞", author: "王之涣" },
                    { title: "金缕衣", author: "杜秋娘" }
                ]
            },
            {
                type: "乐府诗",
                poems: [
                    { title: "塞上曲", author: "王昌龄" },
                    { title: "塞下曲", author: "王昌龄" },
                    { title: "关山月", author: "李白" },
                    { title: "子夜吴歌", author: "李白" },
                    { title: "长干行", author: "李白" },
                    { title: "列女操", author: "孟郊" },
                    { title: "游子吟", author: "孟郊" },
                    { title: "登幽州台歌", author: "陈子昂" },
                    { title: "古意", author: "李颀" },
                    { title: "送陈章甫", author: "李颀" },
                    { title: "琴歌", author: "李颀" },
                    { title: "听董大弹胡笳声兼寄语弄房给事", author: "李颀" },
                    { title: "听安万善吹觱篥歌", author: "李颀" },
                    { title: "夜归鹿门歌", author: "孟浩然" },
                    { title: "庐山谣寄卢侍御虚舟", author: "李白" },
                    { title: "梦游天姥吟留别", author: "李白" },
                    { title: "金陵酒肆留别", author: "李白" },
                    { title: "宣州谢朓楼饯别校书叔云", author: "李白" },
                    { title: "走马川行奉送封大夫出师西征", author: "岑参" },
                    { title: "轮台歌奉送封大夫出师西征", author: "岑参" },
                    { title: "白雪歌送武判官归京", author: "岑参" },
                    { title: "韦讽录事宅观曹将军画马图", author: "杜甫" },
                    { title: "丹青引赠曹将军霸", author: "杜甫" },
                    { title: "寄韩谏议注", author: "杜甫" },
                    { title: "古柏行", author: "杜甫" },
                    { title: "观公孙大娘弟子舞剑器行", author: "杜甫" },
                    { title: "石鱼湖上醉歌", author: "元结" },
                    { title: "山石", author: "韩愈" },
                    { title: "八月十五夜赠张功曹", author: "韩愈" },
                    { title: "谒衡岳庙遂宿岳寺题门楼", author: "韩愈" },
                    { title: "石鼓歌", author: "韩愈" },
                    { title: "渔翁", author: "柳宗元" },
                    { title: "长恨歌", author: "白居易" },
                    { title: "琵琶行", author: "白居易" },
                    { title: "韩碑", author: "李商隐" },
                    { title: "燕歌行", author: "高适" },
                    { title: "古从军行", author: "李颀" },
                    { title: "洛阳女儿行", author: "王维" },
                    { title: "老将行", author: "王维" },
                    { title: "桃源行", author: "王维" },
                    { title: "蜀道难", author: "李白" },
                    { title: "长相思·其一", author: "李白" },
                    { title: "长相思·其二", author: "李白" },
                    { title: "行路难", author: "李白" },
                    { title: "将进酒", author: "李白" },
                    { title: "兵车行", author: "杜甫" },
                    { title: "丽人行", author: "杜甫" },
                    { title: "哀江头", author: "杜甫" },
                    { title: "哀王孙", author: "杜甫" }
                ]
            }
        ];

        // 初始化页面
        document.addEventListener('DOMContentLoaded', function() {
            // 渲染诗歌内容
            renderPoems(tangPoems);
            
            // 初始化作者筛选器
            initAuthorFilter();
            
            // 添加搜索功能
            document.getElementById('searchInput').addEventListener('input', filterPoems);
            
            // 添加类型筛选功能
            document.getElementById('typeFilter').addEventListener('change', filterPoems);
            
            // 添加作者筛选功能
            document.getElementById('authorFilter').addEventListener('change', filterPoems);
        });

        // 渲染诗歌内容
        function renderPoems(poemsData) {
            const container = document.getElementById('poetryContainer');
            container.innerHTML = '';
            
            poemsData.forEach(section => {
                const sectionElement = document.createElement('div');
                sectionElement.className = 'section';
                
                const sectionTitle = document.createElement('div');
                sectionTitle.className = 'section-title';
                sectionTitle.innerHTML = `
                    ${section.type}
                    <span class="count">${section.poems.length}首</span>
                `;
                
                const poemList = document.createElement('ul');
                poemList.className = 'poem-list';
                
                section.poems.forEach(poem => {
                    const poemItem = document.createElement('li');
                    poemItem.className = 'poem-item';
                    poemItem.innerHTML = `
                        <span class="poem-title">${poem.title}</span>
                        <span class="poem-author">${poem.author}</span>
                    `;
                    poemList.appendChild(poemItem);
                });
                
                sectionElement.appendChild(sectionTitle);
                sectionElement.appendChild(poemList);
                container.appendChild(sectionElement);
            });
        }

        // 初始化作者筛选器
        function initAuthorFilter() {
            const authorSet = new Set();
            tangPoems.forEach(section => {
                section.poems.forEach(poem => {
                    authorSet.add(poem.author);
                });
            });
            
            const authorFilter = document.getElementById('authorFilter');
            const authors = Array.from(authorSet).sort();
            
            authors.forEach(author => {
                const option = document.createElement('option');
                option.value = author;
                option.textContent = author;
                authorFilter.appendChild(option);
            });
        }

        // 筛选诗歌
        function filterPoems() {
            const searchTerm = document.getElementById('searchInput').value.toLowerCase();
            const typeFilter = document.getElementById('typeFilter').value;
            const authorFilter = document.getElementById('authorFilter').value;
            
            const filteredData = tangPoems.map(section => {
                // 首先根据类型筛选
                if (typeFilter !== 'all' && section.type !== typeFilter) {
                    return null;
                }
                
                // 然后根据搜索词和作者筛选诗歌
                const filteredPoems = section.poems.filter(poem => {
                    const matchesSearch = searchTerm === '' || 
                        poem.title.toLowerCase().includes(searchTerm) || 
                        poem.author.toLowerCase().includes(searchTerm);
                    
                    const matchesAuthor = authorFilter === 'all' || poem.author === authorFilter;
                    
                    return matchesSearch && matchesAuthor;
                });
                
                // 如果该部分没有匹配的诗歌，返回null
                if (filteredPoems.length === 0) {
                    return null;
                }
                
                return {
                    type: section.type,
                    poems: filteredPoems
                };
            }).filter(section => section !== null);
            
            renderPoems(filteredData);
        }
    </script>
</body>
</html>